package com.ev.asl.config;
import com.ev.asl.vo.ApiParamPushVo;
import com.ev.asl.vo.voBillOfPush.PurchaseBlueOrRedVO;
import com.google.common.collect.Maps;

import java.util.List;
import java.util.Map;

public class ApiParam {


    /** 基础资料的参数  单据参数   */
    public static Map<String, String> paramApiForBasics(int ItemClassId,Boolean sign ) {
        Map<String, String> map = Maps.newHashMapWithExpectedSize(7);
        map.put("Acct", JiateConstant.ACCT);
        map.put("ItemClassId", String.valueOf(ItemClassId));
        map.put("Filter", "");
        if(sign){
            map.put("QueryType", "0");
            map.put("QueryFields", queryFields(ItemClassId));
            //页码 行数 可自定义
            map.put("PageNo","1");
            map.put("PageSize", "1000");
        }
        return map;
    }

    /**
     * 所需字段
     */
    public static String queryFields(int ItemClassId) {
        String queryFields = "FItemId,FNumber,FName";
        switch (ItemClassId) {
            case 1:
                //客户
                queryFields = "FItemId,FNumber,FName,FHelpCode,FShortName,FAddress,FStatus,FStatus_FName,FRegionID_FName,FRegionID,FTrade,FTrade_FName,FContact,FPhone," +
                        "FMobilePhone,FPostalCode,FEmail,FBank,FAccount,Fcorperate,FTypeID,FTypeID_FName";
                break;
            case 2:
                //部门
                queryFields = "FItemId,FNumber,FName,FManager,FManager_FName,FPhone,FFax,FDProperty,FDProperty_FName";
                break;
            case 3:
                //职员  用户
                queryFields = "FItemId,FNumber,FName,FEmpGroup, FEmpGroup_FName,FDepartmentID_FName,FDepartmentID,FGender,FGender_FName,FBirthDay,FDegree,FDegree_FName,FPhone," +
                        "FMobilePhone,FID,FDuty,FDuty_FName,FHireDate,FLeaveDate,FNAME,FAddress,FEmail,FNote";
                break;
            case 4:
                // FNetWeight , FSize
                //物料
                queryFields = "FItemId,FName,FNumber,FHelpCode,FModel,FAuxClassID,FAuxClassID_FName,FErpClsID_FName,FErpClsID,FTypeID,FTypeID_FName,FUnitID,FUnitID_FName," +
                        "FSecInv,FNetWeight ,FSize,FUseState,FUseState_FName,FSecUnitID_FName,FSecUnitID,FSecCoefficient,FDefaultLoc,FDefaultLoc_FName,FSPID_FFullName,FSPID,FLowLimit,FHighLimit";
                break;
            case 5:
                //仓库
                queryFields = "FItemId,FNumber,FName,FEmpID,FEmpID_FName,FAddress,FProperty,FProperty_FName,FTypeID_FName,FTypeID,FSPGroupID";
                break;
            case 8:
                //供应商
                queryFields = "FItemId,FNumber,FName,FHelpCode,FShortName,FAddress,FStatus,FStatus_FName,FContact,FPhone,FMobilePhone,FFax,FEmail,FBank,FAccount,Fcorperate," +
                        "FDiscount,FTypeID,FTypeID_FName";
                break;
            case 100:
                //计量单位
                queryFields = "FMeasureUnitId,FUnitGroupID ,FUnitGroupID_FName,FNumber ,FName,FCoefficient,FStandard,FAuxClass,FConversation,FPrecision";
                break;
            default:
                break;
        }
        return queryFields;
    }

    /** 基础资料的参数  推送单据参数   */
    public static ApiParamPushVo paramApiForPushBill(int tranType, List<PurchaseBlueOrRedVO> billEntry, int rob ) {
        ApiParamPushVo vo = new  ApiParamPushVo();
        vo.setAcct(JiateConstant.ACCT);
        vo.setTrantype(tranType);
        vo.setROB(rob);
        vo.setBillEntrys(billEntry);
        return vo;
    }




}
